<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>医院住院部管理系统-病人</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" th:href="@{/plugins/fontawesome-free/css/all.min.css}">
    <link rel="stylesheet" th:href="@{https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css}">
    <link rel="stylesheet" th:href="@{/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css}">
    <link rel="stylesheet" th:href="@{/plugins/icheck-bootstrap/icheck-bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/plugins/jqvmap/jqvmap.min.css}">
    <link rel="stylesheet" th:href="@{/dist/css/adminlte.min.css}">
    <link rel="stylesheet" th:href="@{/plugins/overlayScrollbars/css/OverlayScrollbars.min.css}">
    <link rel="stylesheet" th:href="@{/plugins/daterangepicker/daterangepicker.css}">
    <link rel="stylesheet" th:href="@{/plugins/summernote/summernote-bs4.css}">
    <link rel="stylesheet" th:href="@{/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css}">
    <link rel="stylesheet" th:href="@{/plugins/datatables-responsive/css/responsive.bootstrap4.min.css}">
    <link th:href="@{https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700}" rel="stylesheet">
</head>
<body class="hold-transition layout-top-nav">
<div class="wrapper">
    <nav class="main-header navbar navbar-expand-md navbar-light navbar-white">
        <div class="container">
            <div class="collapse navbar-collapse order-3">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/patient/index}">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/patient/bill}">费用信息</a>
                    </li>
                </ul>
            </div>
            <ul class="order-1 order-md-3 navbar-nav navbar-no-expand ml-auto">
                <li class="nav-link">
                    <a class="nav-link" href="/patient/index" th:text="${session.username}"></a>
                </li>
                <li class="nav-link">
                    <a class="nav-link" href="/logout" th:text="'注销'"></a>
                </li>
            </ul>
        </div>
    </nav>
    <div class="content-wrapper">
        <div class="content-header">
        </div>
        <div class="content">
            <div class="container">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <div class="card-title">
                                    <h1 class="m-0 text-dark">病人首页</h1>
                                </div>
                            </div>
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table id="table1" class="table table-bordered table-striped">
                                        <thead>
                                        <tr>
                                            <th>姓名</th>
                                            <th>入院日期</th>
                                            <th>出院日期</th>
                                            <th>床位</th>
                                            <th>药物</th>
                                            <th>主治医生</th>
                                            <th>电话</th>
                                            <th>地址</th>
                                            <th>操作</th>
                                            <th>状态</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:if="${patient != null}">
                                            <td th:text="${patient.name}"></td>
                                            <td th:text="${#dates.format(patient.creatDate, 'yyyy-MM-dd')}"></td>
                                            <td th:text="${#dates.format(patient.updateDate, 'yyyy-MM-dd')}"></td>
                                            <td th:if="${patient.bed != null}" th:text="${patient.bed.number}"></td>
                                            <td>
                                                <ul th:if="${patient.drugs != null && !patient.drugs.isEmpty()}">
                                                    <li th:each="drug : ${patient.drugs}" th:text="${drug.drugname}"></li>
                                                </ul>
                                                <span th:unless="${patient.drugs != null && !patient.drugs.isEmpty()}">未分配</span>
                                            </td>
                                            <td th:if="${patient.doctor != null}" th:text="${patient.doctor.name}"></td>
                                            <td th:unless="${patient.doctor != null}" th:text="未分配"></td>
                                            <td th:text="${patient.phone}"></td>
                                            <td th:text="${patient.addr}"></td>
                                            <td>
                                                <a th:href="@{'/patient/modify/'+ ${patient.id}}">
                                                    <button class="btn btn-primary">
                                                        <i class="fa fa-folder"></i>
                                                    </button>
                                                </a>
                                            </td>
                                            <td th:text="${patient.discharged} ? '已出院' : '在院'">出院住院信息</td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div th:insert="temp::footer"></div>
</div>

<script th:src="@{/plugins/jquery/jquery.min.js}"></script>
<script th:src="@{/plugins/bootstrap/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/dist/js/adminlte.min.js}"></script>
<script th:src="@{/dist/js/demo.js}"></script>
<script th:src="@{/plugins/datatables/jquery.dataTables.min.js}"></script>
<script th:src="@{/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js}"></script>
<script th:src="@{/plugins/datatables-responsive/js/dataTables.responsive.min.js}"></script>
<script th:src="@{/plugins/datatables-responsive/js/responsive.bootstrap4.min.js}"></script>
</body>
</html>
